<include file="Public:header" />
<div class="container">
	<!-- Docs nav ================================================== -->
	<div class="page-header" style="border:none; font-size:14px; ">
		<ul class="nav nav-tabs">
		   <li><a  href="{:U('log/index')}"><img src="__PUBLIC__/img/my_log.png"/>&nbsp; {:L('WORK STATEMENTS')}</a></li>
		   <li class="active"><a href="{:U('log/anly')}"><img src="__PUBLIC__/img/tongji.png"/>&nbsp; {:L('ADVANCES IN STATISTICS')}</a></li>
		</ul>
	</div>
	<include file="Public:alert" />
	<p class="view"><b>{:L('VIEW_NAV')}</b>
	<img src="__PUBLIC__/img/by_time.png"/> <a href="{:U('log/anly','by=all')}" <if condition="$Think.get.by eq 'all'">class="active"</if>>{:L('ALL')}</a> | 
	<a href="{:U('log/anly','by=today')}" <if condition="$Think.get.by eq 'today'">class="active"</if>>{:L('CREATE_TODAY')}</a> | 
	<a href="{:U('log/anly','by=week')}" <if condition="$Think.get.by eq 'week'">class="active"</if>>{:L('CREATE_THIS_WEEK')}</a> | 
	<a href="{:U('log/anly','by=month')}" <if condition="$Think.get.by eq 'month'">class="active"</if>>{:L('CREATE_THIS_MONTH')}</a>
	</p>
	<div class="row">
		<div class="span2 knowledgecate">
			<ul class="nav nav-list">
				<li class="active">
					<a href="javascript:void(0);">{:L('VIEW_BY_LOG_CATEGORY')}</a>
				</li>
				<li><a href="{:U('log/anly','by='.$_GET['by'])}" <if condition="$_GET['module'] eq null">class="active"</if>><i class="icon-white icon-chevron-right"></i>{:L('ALL')}</a></li>
				<li><a <if condition="$_GET['module'] == 'customer'">class="active"</if> href="{:U('Log/anly','r=rCustomerLog&module=customer&by='.$_GET['by'])}"><i class="icon-chevron-right"></i>{:L('CUSTOMER')}</a></li>
				<li><a <if condition="$_GET['module'] == 'business'">class="active"</if> href="{:U('Log/anly','r=rBusinessLog&module=business&by='.$_GET['by'])}"><i class="icon-chevron-right"></i>{:L('BUSINESS')}</a></li>
				<li><a <if condition="$_GET['module'] == 'leads'">class="active"</if> href="{:U('Log/anly','r=rLeadsLog&module=leads&by='.$_GET['by'])}"><i class="icon-chevron-right"></i>{:L('LEADS')}</a></li>
				<li><a <if condition="$_GET['module'] == 'task'">class="active"</if> href="{:U('Log/anly','r=rLogTask&module=task&by='.$_GET['by'])}"><i class="icon-chevron-right"></i>{:L('TASK')}</a></li>
				<li><a <if condition="$_GET['module'] == 'event'">class="active"</if> href="{:U('Log/anly','r=rEventLog&module=event&by='.$_GET['by'])}"><i class="icon-chevron-right"></i>{:L('EVENT')}</a></li>
				<li><a <if condition="$_GET['module'] == 'contacts'">class="active"</if> href="{:U('Log/anly','r=rContactsLog&module=contacts&by='.$_GET['by'])}"><i class="icon-chevron-right"></i>{:L('CONTACTS')}</a></li>
			</ul>
		</div>
		<div class="span10">
			<ul class="nav pull-left">		
				<li class="pull-left"><a id="delete" class="btn" style="margin-right: 5px;"><i class="icon-remove"></i>&nbsp;{:L('DELETE')}</a> </li>
				<!-- <if condition="$_GET['type'] == 1">
					<select style="width:auto;"  class="nav pull-left" id="module" onchange="changeContent()">
						<option <if condition="$_GET['module'] == null">selected</if> value="6">全部模块</option>
						<option <if condition="$_GET['module'] == 'customer'">selected</if> value="1">客户</option>
						<option <if condition="$_GET['module'] == 'contacts'">selected</if> value="2">联系人</option>
						<option <if condition="$_GET['module'] == 'business'">selected</if> value="3">商机</option>
						<option <if condition="$_GET['module'] == 'task'">selected</if> value="4">任务</option>
						<option <if condition="$_GET['module'] == 'event'">selected</if> value="5">日程</option>
					</select>
				</if> -->
				<li class="pull-left">
					<form class="form-inline" id="searchForm" action="index.php" method="get">
						<ul class="nav pull-left">
							<li class="pull-left">
								{:L('ROLE_NAME')}&nbsp; <select style="width:auto" name="role" id="role" >
									<option class="all" value="all">{:L('ALL')}</option>
									<volist name="role_list" id="vo">
										<option <if condition="$_GET['role'] == $vo.role_id">selected="selected"</if> value="{$vo.role_id}">{$vo.role_name}-{$vo.user_name}</option>
									</volist>
								</select>&nbsp;&nbsp;
							</li>
							
							<li class="pull-left">
								{:L('SELECT DATE')}&nbsp; {:L('FROM')}<input type="text" id="start_time" name="start_time" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" class="Wdate" style="width:auto;" value="{$Think.get.start_time}"/>{:L('TO')}<input type="text" id="end_time" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" style="width:auto;" name="end_time" class="Wdate" value="{$Think.get.end_time}" />&nbsp;&nbsp;
							</li>
							
							<li class="pull-left"><input type="hidden" name="m" value="log"/><input type="hidden" name="a" value="anly"/>
							<if condition="$Think.get.by neq null"><input type="hidden" name="by" value="{$Think.get.by}"/></if>
							<if condition="$Think.get.type neq null"><input type="hidden" name="type" value="{$Think.get.type}"/></if>
							<if condition="$Think.get.module neq null"><input type="hidden" name="module" value="{$Think.get.module}"/></if>
							<if condition="$Think.get.r neq null"><input type="hidden" name="r" value="{$Think.get.r}"/></if>
							<button type="submit" class="btn"> <img src="__PUBLIC__/img/search.png"/>{:L('SEARCH')}</button></li>
							
						</ul>
					</form>
				</li>
			</ul>
			<div class="pull-right">
				<a href="{:U('log/mylog_add')}" class="btn btn-primary"><i class="icon-plus"></i>&nbsp; {:L('ADD_LOG')}</a>
			</div>
		</div>
		<div class="span10">
			<form id="form1" method="post">
			<table class="table table-hover table-striped">
				<if condition="$list eq null">
					<tr><td>{:L('EMPTY_TPL_DATA')}</td></tr>
				<else/>
					<thead>
						<tr>
							<th><input id="check_all" class="control_all" type="checkbox" /></th>
							<th width="10px"></th>
							<th>{:L('SUBJECT')}</th>
							<th>{:L('ROLE_NAME')}</th>
							<if condition = "($_GET['module'] eq '')">
								<th>{:L('BELONG_TO')}</th>
							<elseif condition = "($_GET['module'] eq 'customer')" />
								<th>{:L('BELONG_TO')}</th>
							<elseif condition = "($_GET['module'] eq 'contacts')" />
								<th>{:L('BELONG_TO_CONTACTS')}</th>
							<elseif condition = "($_GET['module'] eq 'business')" />
								<th>{:L('BELONG_TO_BUSINESS')}</th>
							<elseif condition = "($_GET['module'] eq 'task')" />
								<th>{:L('BELONG_TO_TASK')}</th>
							<elseif condition = "($_GET['module'] eq 'event')" />
								<th>{:L('BELONG_TO_EVENT')}</th>
							<elseif condition = "($_GET['module'] eq 'leads')" />
								<th>{:L('BELONG_TO_LEADS')}</th>
							</if>
							<if condition="$_GET['module'] eq 'business' || $_GET['module'] eq 'leads'">
								<th style="width:20%">{:L('NEXT_LINK')}</th>
							</if>
							<th>{:L('CREATE_TIME')}</th>
							<th  style="width:10%">{:L('OPERATING')}</th>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<td colspan="8">
								<p>{:L('NOTE_')}<span style="color:green"><i class="icon-check"></i></span>{:L('HAVE_SUPERIORS_COMMENTS')} &nbsp; &nbsp;  <span style="color:red"><i class="icon-edit"></i></span>{:L('NO_SUPERIORS_COMMENTS')}</p>
								{$page}
							</td>
						</tr>
					</tfoot>
					<tbody>
						<volist name="list" id="vo">
						<tr>
							<td><input class="check_list" type="checkbox" name="log_id[]" value="{$vo.log_id}"/></td>
							<td><if condition="$vo['is_comment']"><span style="color:green"><i class="icon-check"></i></span><else /><span style="color:red"><i class="icon-edit"></i></span></if></td>
							<td><a href="{:U('log/mylog_view','id='.$vo['log_id'].'&type='.$_GET['type'])}"><if condition="$vo['subject'] ">{$vo.subject}<else />{$vo['content']|msubstr=###,0,20}...</if></a></td>
							<td><notempty name="vo.creator.user_name"><a class="role_info" rel="{$vo.creator.role_id}" href="javascript:void(0)">{$vo.creator.user_name}</a></notempty></td>

							<td>
								<if condition="$vo['customer_name'] neq null">
									<a href="{:U('customer/view','id='.$vo['customer_id'])}" target="blank">{$vo.customer_name}</a>
								<elseif condition="$vo['contacts_name'] neq null" />
									<a href="{:U('contacts/view','id='.$vo['contacts_id'])}" target="blank">{$vo.contacts_name}</a>
								<elseif condition="$vo['business_name'] neq null" />
									<a href="{:U('business/view','id='.$vo['business_id'])}" target="blank">{$vo.business_name}</a>
								<elseif condition="$vo['task_name'] neq null" />
									<a href="{:U('task/view','id='.$vo['task_id'])}" target="blank">{$vo.task_name}</a>
								<elseif condition="$vo['event_name'] neq null" />
									<a href="{:U('event/view','id='.$vo['event_id'])}" target="blank">{$vo.event_name}</a>
								<elseif condition="$vo['leads_name'] neq null" />
								<a href="{:U('leads/view','id='.$vo['leads_id'])}" target="blank">{$vo.leads_name}</a>
								<else />
									{:L('NONE')}
								</if>
							</td>
							<if condition="$_GET['module'] eq 'business' || $_GET['module'] eq 'leads'">
								<td><if condition="$vo['nextstep_time']">{$vo.nextstep_time|date="Y-m-d H:i",###} &nbsp; {$vo.nextstep}</if></td>
							</if>
							<td>{$vo.create_date|date="Y-m-d H:i",###}</td>
							<td>
								<a href="{:U('log/mylog_view','id='.$vo['log_id'].'&type='.$_GET['type'])}">{:L('VIEW')}</a>
								<a href="{:U('log/mylog_edit','id='.$vo['log_id'].'&type='.$_GET['type'])}">{:L('EDIT')}</a>
							</td>
						</tr>
						</volist>
					</tbody>
				</if>
			</table>
			</form>
		</div>
	</div>
</div>
<div class="hide" id="dialog-role-info" title="{:L('DIALOG_USER_INFO')}">loading...</div>
<script type="text/javascript">
$("#dialog-role-info").dialog({
    autoOpen: false,
    modal: true,
	width: 600,
	maxHeight: 400,
	position: ["center",100]
});
$(function(){
	<if condition="$Think.get.role neq null">
		$("#role option[value='{$Think.get.role}']").prop("selected", true);
	</if>
	$('#delete').click(function(){
		if(confirm('{:L('CONFIRM_DELETE')}')){
			$("#form1").attr('action', '{:U("log/log_delete")}');
			$("#form1").submit();
		}
	});
	$(".role_info").click(function(){
		$role_id = $(this).attr('rel');
		$('#dialog-role-info').dialog('open');
		$('#dialog-role-info').load('{:U("user/dialoginfo","id=")}'+$role_id);
	});
	$("#check_all").click(function(){
		$("input[class='check_list']").prop('checked', $(this).prop("checked"));
	});
})

</script>
<include file="Public:footer" />
